package cn.tedu.yxcar.product.controller;


import cn.tedu.yxcar.product.pojo.dto.order.OrderAddDTO;

import cn.tedu.yxcar.product.service.IOrderService;
import cn.tedu.yxcar.product.web.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order")
@Api(tags ="订单管理模块")
public class OrderController {
    @Autowired
    private IOrderService OrderService;

    @PostMapping("/add")
    @ApiOperation("执行新增订单的功能")
//    @PreAuthorize("hasRole('user')")
    public JsonResult addOrder(@Validated OrderAddDTO orderAddDTO){
        OrderService.addOrder(orderAddDTO);
        return JsonResult.ok();
    }





}







